﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Weight.Controls
{
    public partial class WSDataGridView : DataGridView
    {
        public WSDataGridView()
        {
            InitializeComponent();
        }

        public WSDataGridView(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        public void SetSkin(Color color)
        {
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle = new System.Windows.Forms.DataGridViewCellStyle();
            dataGridViewCellStyle.SelectionBackColor = color;
            this.RowsDefaultCellStyle = dataGridViewCellStyle;
            
            SetDataCellStyle();
            SetHeaderStyle();
        }

        /// <summary>
        /// 设置GirdView 列标题样式
        /// </summary>
        /// <param name="gridView"></param>
        public void  SetHeaderStyle()
        {
            ColumnHeadersDefaultCellStyle.Font = new Font("楷体", 12, FontStyle.Regular);
        }


        /// <summary>
        /// 设置GridView 数据单元格样式
        /// </summary>
        /// <param name="gridView">dataGridView控价</param>
        public virtual void  SetDataCellStyle()
        {
            this.RowsDefaultCellStyle.Font = new Font("楷体", 11, FontStyle.Regular);
        }
    }
}
